﻿namespace HHFileViewServer
{
    /// <summary>
    /// 常量
    /// </summary>
    public class Const
    {
        /// <summary>
        /// 文件大小限制
        /// </summary>
        public static int FileSizeLimit => ServerOp.ServerConfig.SizeLimit * 1024;

        /// <summary>
        /// 拼接文件绝对地址
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public static string AbsolutePath(string fileName) => ServerOp.ServerConfig.DownloadPath + @"\" + fileName;

        /// <summary>
        /// 拼接文件相对地址
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public static string RelativePath(string fileName) => "/file/" + fileName;

        /// <summary>
        /// 转换标准路径
        /// </summary>
        public static string StandardPath => new DirectoryInfo(ServerOp.ServerConfig.DownloadPath).FullName;

        /// <summary>
        /// 默认文件夹
        /// </summary>
        public static string DefaultFolder => ServerOp.RootPath + "hhfileview";

        /// <summary>
        /// LibreOffice默认安装地址
        /// </summary>
        public const string DefaultLibreOfficePath = @"C:\Program Files\LibreOffice\program\soffice.exe";
    }
}
